<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<title>aier360登录</title>
    <!--[if lt IE 9]>
    <script src='${aier_new_js_url}assets/html5shiv.js' type='text/javascript'></script>
    <![endif]-->    
<link rel='stylesheet' type='text/css' href="${aier_new_css_url}assets/stylesheets/bootstrap/bootstrap.css">
<link rel='stylesheet' type='text/css' href="${aier_new_css_url}assets/stylesheets/bootstrap/bootstrap-responsive.css">
<link rel='stylesheet' type='text/css' href="${aier_new_css_url}assets/stylesheets/jquery_ui/jquery-ui-1.10.0.custom.css" />
<style>
#ToolBar {
 position: absolute;
 bottom: 0;
 padding: 10px 0;
 width: 100%;

}
</style>
<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}ui.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/ja.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/multiselect.js"></script>
</head>
<body>

<div class="nav-collapse">  	
       <img src="${aier_new_img_url}logxtop.png" />
</div>

<div class="row" > 
            <div style="width:100%; height: 459px;background-image:url(${aier_new_img_url}logxmid.png);" >           
             <!-- login  style="background-image:url(${aier_new_img_url}loginbg.png)"  -->		
             		
				<div style=" width:300px;float:right; margin-right:50px; background-image:url(${aier_new_img_url}loginpanle.png); " >			
					<div  style="margin-top: 30px; margin-left:30px;  width: 240px;">
												
							<div class="input-prepend">
								<span class="add-on"><i class="icon-user"></i></span>
								<input type="text"  name="phoneNumber" id="phoneNumber" onkeypress="jumpPassword(event)"  onBlur="checkStatus(this)" onfocus="deletestart();" placeholder="请输入手机号码">
							</div>						
							<div class="input-prepend">
								<span class="add-on"><i class="icon-lock"></i></span>
								<input type="password"  name="password" id="password" onkeypress="jumpLogin(event)" placeholder="请输入密码">
							
							</div><br/>
							<div class="input-prepend">
				            		<span class="add-on"><i class="icon-user"></i></span>
									<select id="userstruts">
										<option  value="-1">请选择身份</option>
									</select>
				            </div>
							<div class="pswhelp clearfix" >
									<a class="btn btn-block btn-info" href="javascript:void(0);" id="regNow" onclick="user_login();"><span>登陆</span></a><br/>
									<a href="${aier_url}user/retpwd_identitiesVerify${aier_suffix}" >忘记密码？</a>
									<hr>
									<a class="btn btn-block btn-success" href="javascript:void(0);" id="" onclick=""><span>申请试用</span></a>
							</div><br>
					</div>					
			<!-- /login -->

			</div>
			
 
			
     </div>
     
</div>
				
				
<div id="ToolBar">
	<img src="${aier_new_img_url}logxfot.png" />
</div>
<script type="text/javascript">
$().ready(function(){
	$('#phoneNumber').focus();
});

	function jumpPassword(event) {
		var keycode = event.keyCode || event.which;
		if (keycode == 13) {
			$('#password').focus();
		} else {
			return false;
		}
	}

	function jumpLogin(event) {
		var keycode = event.keyCode || event.which;
		if (keycode == 13) {
			user_login();
		} else {
			return false;
		}
	}


	function user_login(){
		var account = $("#phoneNumber").val();
		var pwd = $("#password").val();	
		var appStatus=$('#userstruts option:selected').val();
		if(account==""||pwd==""){
			$().message("请输入用户名密码");
			return
		}

		var fun = function(data) {
			if(data.s==1){
				
				if(data.appStatus==1)
					window.location.href = "${aier_url}${aier_uri}school_schoolManager${aier_suffix}?uid="+data.uid+"&sid="+data.sid;
					
				if(data.appStatus==2)
					window.location.href = "${aier_url}${aier_uri}school_schoolinfo${aier_suffix}?uid="+data.uid+"&sid="+data.sid;
					
			}else{
				$().message("登陆失败"+data.error_info);
			}
		};
		exeAjax(ajaxUrl("${aier_url}${aier_urijs}nalogin_naLogin${aier_suffix}"), fun, {
			"account" :$('#phoneNumber').val(),
			"pwd" :$('#password').val(),
			"appStatus":appStatus,
		});
	}
	
	function check_phone(phone){
		var regu = /^[1]([3-8][0-9]{1}|59|58|88|89)[0-9]{8}$/;
		var isphone = regu.exec(phone);
		if(isphone!=null){
			return "true";
		}else{
			return "fasle";					
		}			
	}
	function deletestart(){
		   $("#userstruts option[value='1']").remove();
		   $("#userstruts option[value='2']").remove();
		   $("#userstruts option[value='3']").remove();
		   $("#userstruts option[value='4']").remove();
		   $("#userstruts option[value='5']").remove();
	}
	//加载出用户权限
	function checkStatus(object){
		var va= $('#phoneNumber').val();
		if(va.length==0 || va.length<0){
		   $("#userstruts option[value='1']").remove();
  		   $("#userstruts option[value='2']").remove();
		   $("#userstruts option[value='3']").remove();
  		   $("#userstruts option[value='4']").remove();
  		   $("#userstruts option[value='5']").remove();
			return false; 
		}
		
		$.ajax({ 
	           type: "post", 
               url:  "${aier_url}${aier_urijs}nalogin_checkUserSturts${aier_suffix}", 
               data:{"account":va},
               dataType: "json", 
               success: function (data) { 
            	   if(data.s==0){
            		   $("#userstruts option[value='1']").remove();
            		   $("#userstruts option[value='2']").remove();
            		   $("#userstruts option[value='3']").remove();
            		   $("#userstruts option[value='4']").remove();
            		   $("#userstruts option[value='5']").remove();
            		   alert(data.error_info);
            	   }else{
            		   //处理事件
            		  var status= data.appStatus;
            		  changeSelectOption (status);
            	   }
               }, 
               error: function (XMLHttpRequest, textStatus, errorThrown) { 
                       alert("对不起，您不能登录!"); 
               } 
       });
	}
	//下拉选择加载框
	function  changeSelectOption (object){		
		var strs=[];
		strs = object.split(",");
		length=strs.length;
		if($("#userstruts option").length>=length)
			return false;
		
		for (var i=0;i<length;i++) {
			if(strs[i]==1)
			$("#userstruts").append("<option value='"+1+"'>学校管理员</option>");
			
			if(strs[i]==2)
			$("#userstruts").append("<option value='"+2+"'>班级管理员</option>");
			
			if(strs[i]==3)
				$("#userstruts").append("<option value='"+3+"'>考勤管理员</option>");
				
			if(strs[i]==4)
				$("#userstruts").append("<option value='"+4+"'>IC卡管理员</option>");
				
			if(strs[i]==5)
				$("#userstruts").append("<option value='"+5+"'>普通教师</option>");
		};
		return true;
	}
</script>
</body>
</html>